<template>
  <div>
    {{text}}
  </div>
</template>

<script>
import { baseMixin } from '@/store/app-mixin';

const map = {
  MINUTE: '分钟',
  HOUR: '小时',
  DAY: '天'
}

export default {
    name: 'DelayColView',
    mixins: [baseMixin],
    props: {
      delayStr: {
        type: String,
        default: '{}'
      },
    },
    data () {
      return {
        text: '满足条件后立即触达'
      }
    },
    mounted () {
      this.init();
    },
    methods: {
      init () {
        const json = JSON.parse(this.delayStr) || {};
        if (json.delay_config && json.delay_config.value) {
          this.text = '满足条件后' + json.delay_config.value + map[json.delay_config.unit] + '内触达';
        }
      },
    }
  }
</script>

<style scoped>

</style>